import type { Brand, BrandPageDto } from '@/models/brand'
import type { CommonResult, CommonPage } from '@/models/request'
import request, { ContentTypeEnum } from '@/utils/request'
export function fetchList(params: BrandPageDto) {
  return request<CommonPage<Brand>>({
    url: '/brand/list',
    method: 'get',
    params: params,
  })
}
export function createBrand(data: Brand) {
  return request<CommonResult>({
    url: '/brand/create',
    method: 'post',
    data: data,
  })
}
export function updateShowStatus(data: { ids: string; showStatus: number }) {
  return request<CommonResult>({
    url: '/brand/update/showStatus',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}

export function updateFactoryStatus(data: { ids: string; factoryStatus: number }) {
  return request<CommonResult>({
    url: '/brand/update/factoryStatus',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}

export function deleteBrand(id: number) {
  return request<CommonResult>({
    url: '/brand/delete/' + id,
    method: 'get',
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}

export function getBrand(id: number) {
  return request<CommonResult<Brand>>({
    url: '/brand/' + id,
    method: 'get',
  })
}

export function updateBrand(id: number, data: Brand) {
  return request<CommonResult>({
    url: '/brand/update/' + id,
    method: 'post',
    data: data,
  })
}
